<?php /* Smarty version 2.6.19, created on 2008-04-06 14:01:47
         compiled from admin_invoices.tpl */ ?>
<div class="pagebody">

	<form name="add_invoice" method="post" action="<?php echo $this->_tpl_vars['FORM_ACTION']; ?>
">
	<input type="hidden" name="invoiceid" id="invoiceid" value="<?php echo $this->_tpl_vars['INVOICE_ID']; ?>
">
	<table width="100%" border="0" id="invoicetable">
		<tr>
			<td>Bill To
				<select name="inv_client" id="inv_client"/>
					<option value="">Choose</option>
					<?php $_from = $this->_tpl_vars['CLIENT_OPTIONS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['client']):
?>
						<?php if ($this->_tpl_vars['client']->id == $this->_tpl_vars['SELECTED_CLIENT']): ?>
							<option value="<?php echo $this->_tpl_vars['client']->id; ?>
" selected="selected"><?php echo $this->_tpl_vars['client']->BusinessName; ?>
</option>
						<?php else: ?>
							<option value="<?php echo $this->_tpl_vars['client']->id; ?>
"><?php echo $this->_tpl_vars['client']->BusinessName; ?>
</option>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
				</select>
			</td>
			<td>Repeat</td>
			<td>Until</td>
			<td>Payment Terms</td>
			<td>Date</td>
			<td>Due Date</td>
			<td>Invoice Number</td>
		</tr>

		<tr rowspan="8" valign="top">
			<td valign="top"><textarea name="billto" id="billto" rows="5" cols="30" readonly="readonly"></textarea></td>
			<td><select name="repeat">
					<option value="">Choose</option>
					<option value="Daily">Daily</option>
					<option value="Weekly">Weekly</option>
					<option value="Monthly">Monthly</option>
				</select></td>
			<td><input type="text" size="8" name="until" /><img src="<?php echo $this->_tpl_vars['SITE_WWW']; ?>
img/cal.png" border="0" onClick="cal1xx.select(document.forms[0].until,'anchor3xx','dd/MM/yyyy'); return false;" title="cal1xx.select(document.forms[0].until,'anchor3xx','MM/dd/yyyy'); return false;" name="anchor3xx" id="anchor3xx"/></td>
			<td><select name="terms">
					<option value="">Choose</option>
					<?php $_from = $this->_tpl_vars['PAYMENT_TERMS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['term']):
?>
						<option value="<?php echo $this->_tpl_vars['key']; ?>
"><?php echo $this->_tpl_vars['term']; ?>
</option>
					<?php endforeach; endif; unset($_from); ?>
				</select><img src="img/edit_add.png" border="0" id="addTerms" /></td>
			<td><input type="text" size="8" name="inv_date" value="<?php echo $this->_tpl_vars['INVOICE_DATE']; ?>
" /><img src="<?php echo $this->_tpl_vars['SITE_WWW']; ?>
img/cal.png" border="0" onClick="cal1xx.select(document.forms[0].inv_date,'anchor1xx','dd/MM/yyyy'); return false;" TITLE="cal1xx.select(document.forms[0].inv_date,'anchor1xx','MM/dd/yyyy'); return false;" name="anchor1xx" id="anchor1xx" /></td>
			<td><input type="text" size="8" name="inv_duedate" value="<?php echo $this->_tpl_vars['INVOICE_DUEDATE']; ?>
" /><img src="<?php echo $this->_tpl_vars['SITE_WWW']; ?>
img/cal.png" border="0" onClick="cal1xx.select(document.forms[0].inv_duedate,'anchor2xx','dd/MM/yyyy'); return false;" TITLE="cal1xx.select(document.forms[0].inv_duedate,'anchor2xx','MM/dd/yyyy'); return false;" name="anchor2xx" id="anchor2xx" /></td>
			<td><input type="text" size="8" name="inv_invoicenumber" value="<?php echo $this->_tpl_vars['INVOICE_NUMBER']; ?>
" /></td>
		</tr>
	</table>

	<table>
		<tr>
			<td width="15%">Item Select</td>
			<td width="35%">Item Description</td>
			<td width="5%">Qty</td>
			<td>Amount Each</td>
			<td>Tax</td>
			<td>Total</td>
		</tr>

		<?php $this->assign('rowcount', '0'); ?>
		<?php $_from = $this->_tpl_vars['INVOICE_ITEMS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['inv_item']):
?>
		<tr id="<?php echo $this->_tpl_vars['rowcount']; ?>
">
			<td>
			<select name="item_itemid[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" id="item_itemid[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]">
			<option value="">Choose</option>
			<?php $this->assign('lastcat', ''); ?>

			<?php $_from = $this->_tpl_vars['AVAILABLE_ITEMS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['i']):
?>
				<?php if ($this->_tpl_vars['i']->CategoryID != $this->_tpl_vars['lastcat']): ?>
					<option value=""><?php echo $this->_tpl_vars['i']->CategoryName; ?>
</option>
				<?php endif; ?>
				<?php if ($this->_tpl_vars['inv_item']->ItemID == $this->_tpl_vars['i']->id): ?>
					<option value="<?php echo $this->_tpl_vars['i']->id; ?>
" selected="selected"><?php echo $this->_tpl_vars['i']->Name; ?>
</option>
				<?php else: ?>
					<option value="<?php echo $this->_tpl_vars['i']->id; ?>
" ><?php echo $this->_tpl_vars['i']->Name; ?>
</option>
				<?php endif; ?>
				<?php $this->assign('lastcat', $this->_tpl_vars['i']->CategoryID); ?>
			<?php endforeach; endif; unset($_from); ?>

			</select></td>
			<td><input type="text" id="item_description[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" name="item_description[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" value="<?php echo $this->_tpl_vars['inv_item']->Description; ?>
" /></td>
			<td><input type="text" id="item_quantity[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" name="item_quantity[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" value="<?php echo $this->_tpl_vars['inv_item']->Quantity; ?>
" /></td>
			<td><input type="text" id="item_amounteach[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" name="item_amounteach[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" value="<?php echo $this->_tpl_vars['inv_item']->AmountEach; ?>
" /></td>
			<td><input type="text" id="item_taxamount[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" name="item_taxamount[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" value="<?php echo $this->_tpl_vars['inv_item']->TaxAmount; ?>
" /></td>
			<td><input type="text" id="rowtotal[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" name="rowtotal[<?php echo $this->_tpl_vars['inv_item']->InvoiceItemID; ?>
]" value="<?php echo $this->_tpl_vars['inv_item']->RowTotal; ?>
" /></td>
		</tr>
		<?php $this->assign('rowcount', $this->_tpl_vars['rowcount']+1); ?>
		<?php endforeach; endif; unset($_from); ?>

		<?php $this->assign('rowcount', $this->_tpl_vars['rowcount']+1); ?>
		<tr id="<?php echo $this->_tpl_vars['rowcount']; ?>
">
			<td>
			<select name="item_itemid[New][0]" id="item_itemid[New][0]">
			<option value="">Choose</option>
			<?php $this->assign('lastcat', ''); ?>

			<?php $_from = $this->_tpl_vars['AVAILABLE_ITEMS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['i']):
?>
				<?php if ($this->_tpl_vars['i']->CategoryID != $this->_tpl_vars['lastcat']): ?>
					<option value=""><?php echo $this->_tpl_vars['i']->CategoryName; ?>
</option>
				<?php endif; ?>
				<option value="<?php echo $this->_tpl_vars['i']->id; ?>
"><?php echo $this->_tpl_vars['i']->Name; ?>
</option>
				<?php $this->assign('lastcat', $this->_tpl_vars['i']->CategoryID); ?>
			<?php endforeach; endif; unset($_from); ?>

			</select></td>
			<td><input type="text" id="item_description[New][0]" name="item_description[New][0]" /></td>
			<td><input type="text" id="item_quantity[New][0]" name="item_quantity[New][0]" /></td>
			<td><input type="text" id="item_amounteach[New][0]" name="item_amounteach[New][0]" /></td>
			<td><input type="text" id="item_taxamount[New][0]" name="item_taxamount[New][0]" /></td>
			<td><input type="text" id="rowtotal[New][0]" name="rowtotal[New][0]" /></td>
		</tr>



	</table>

	<table width="100%" id="invoiceoptionstable">
		<tr>
			<td><label for "email">Email to Client: <input type="checkbox" name="email" checked="checked" /></label></td>
			<td><input type="button" id="Export" value="Export" onclick="return exportAs(this);" /> <input type="submit" id="submit" name ="submit" value="Save" /></td>
		</tr>
	</table>
	</form>
</div>

<div id="exportas" class="exportas">
Export As;<br />
<form name="exportas" action="admin_invoices_export.php" target="_blank">
<table>
    <tr>
        <td>
        	<img src="<?php echo $this->_tpl_vars['SITE_WWW']; ?>
img/spreadsheet_document.png" alt="CSV" title="CSV" /><input type="radio" name="exportas" value="csv" /><br />
			<img src="<?php echo $this->_tpl_vars['SITE_WWW']; ?>
img/pdf.png"  alt="PDF" title="PDF" /> <input type="radio" name="exportas" value="pdf" /><br />
        </td>
        <td>
        	<input type="submit" name="submit" value="go" /></form>
        </td>
    </tr>
</table>
</div>

<div id="myPanel"> 
	<div class="hd">Add Payment Terms</div> 
	<div class="bd">
		<form name="paymentTerms" action="<?php echo $this->_tpl_vars['FORM_ACTION']; ?>
" method="POST">
			<input type="text" name="addTerm" id="addTerm" size="30" /><br />
			<input type="submit" name="submit" value="Add" />
		</form>
	</div>
</div>